package com.sy.pet.controller.admin;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.sy.pet.commom.ResultBean;
import com.sy.pet.dto.PetDTO;
import com.sy.pet.dto.PetQueryDTO;
import com.sy.pet.dto.PetTagDTO;
import com.sy.pet.service.PetInfoService;
import com.sy.pet.vo.PetVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @Author: liangSY
 * @Date: 2024/9/14
 * @ClassName: PetController
 * @Description: PetController描述
 */
@RequestMapping("/admin/pet")
@RestController
public class PetController {

    @Autowired
    PetInfoService petInfoService;

    @PostMapping
    private ResultBean<String> addTag(@Valid PetDTO dto){
        petInfoService.add(dto);
        return ResultBean.success();
    }

    @PostMapping("/page")
    private ResultBean<IPage<PetVO>> getPetList(@RequestBody PetQueryDTO dto){
        IPage<PetVO> all = petInfoService.getDataByPage(dto);
        return ResultBean.success(all);
    }
}
